Skip to content

[Core] Add node-local LMCache pools for vLLM - #1283

Draft
fredericsun wants to merge 7 commits into
mainfrom
kvcachepool-lmcache-mvp
Draft

fredericsun wants to merge 7 commits into
mainfrom
kvcachepool-lmcache-mvp

Conversation

@fredericsun

@fredericsun fredericsun commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

A namespace-scoped KVCachePool with deploymentMode: NodeLocal runs one LMCache multiprocess server per selected node. OME owns the DaemonSet, a Service that routes to ready endpoints on the same node, and a ConfigMap with the connection settings. A ServingRuntime declares support for LMCacheMPConnector. An InferenceService references the pool with spec.kvCachePool.name, and OME configures the vLLM engine when rendering its Pod template. OEP-0010 · Sample manifests and smoke test

Why we need it

A vLLM Pod can reuse KV entries from another Pod on the same node when both connect to the same LMCache server. A pool gives platform administrators one place to select those nodes and budget host memory. Service owners can then reference the pool by name, and deleting one service keeps the cache available to other consumers.

How to test

From the repository root, point KUBEBUILDER_ASSETS at Kubernetes 1.35 envtest binaries (kube-apiserver and etcd) and run:

go test -count=1 ./pkg/controller/v1beta1/kvcachepool ./pkg/render ./pkg/apis/ome/v1beta1
go test -count=1 -run '^TestKVCacheSampleReconciles$' ./pkg/controller/v1beta1/inferenceservice

TestLMCachePoolLifecycle submits example.invalid/LMCache:test, checks that the pool reports InvalidSpec without creating a DaemonSet, then corrects the image and verifies that reconciliation proceeds. To check actual KV reuse, follow the GPU prerequisites and request probe in the sample walkthrough.

Functional validation

Two single-Pod vLLM services, A and B, served Llama 3.1 8B Instruct on the same GPU node and referenced one pool. The test used LMCache v0.5.1 and disabled vLLM local prefix caching. Each request shared a 1,024-token prefix and varied the final token. We measured the change in vllm:external_prefix_cache_hits_total for each request and checked the server's store and retrieve logs.

We repeated all three scenarios with privileged mode disabled on the LMCache server. A test-only admission webhook removed the server container's privileged field. The original and replacement server Pod templates matched the baseline in every other field, including hostIPC: true and runtimeClassName: nvidia.

OME omits securityContext.privileged from new LMCache server containers. Control-plane tests verify that the generated template omits the field, the reconciled DaemonSet has privileged mode disabled, and the Pod uses host IPC and the configured RuntimeClass.

Scenario Observed result
Cross-Pod reuse A's cold request had zero external hits and populated the cache. B's first request for the same prefix, in a different Pod, retrieved all 1,024 tokens.
Two services share one pool After deleting A and waiting for its workload to exit, the pool, cache server and B kept their identities. B hit all 1,024 tokens again. Requesting pool deletion while B still referenced it retained the server until B was removed.
Cache server restart We deleted only the server Pod. The DaemonSet replaced it. B's client detected the outage and re-registered its GPU context on the new server. B kept the same Pod and container with zero restarts. In the repeat run, three successive requests after replacement recorded 0, 0 and 1,024 external hit tokens. After confirming the old server was gone, we used another fresh prefix and measured 0 then 1,024 external hit tokens.

When a vLLM Pod may need a restart

The server keeps its L1 entries and GPU registrations in process memory. After replacement, each existing worker must tell the new server how to access its GPU KV tensors. In this run the client heartbeat observed an unhealthy-to-healthy transition, which triggered re-registration. If a replacement happens between successful heartbeats, the v0.5.1 client can miss the change. The engine can keep serving completions while the server reports an unregistered GPU context and repeated requests still have zero external hits. Restarting the affected vLLM Pod re-registers it. A cold miss immediately after server replacement is expected. LMCache upstream issue #4642

Checklist

  • Tests added/updated
  • Docs updated
  • make test passes locally with Go 1.26.7 at ee4b88e0.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions github-actions Bot added documentation Documentation changes api API/Types changes in pkg/apis helm Helm chart changes crd CRD definition changes webhook Webhook changes inferenceservice InferenceService controller changes rbac RBAC configuration changes controller Controller changes oep OME Enhancement Proposal tests Test changes config Configuration changes dependencies Dependency updates labels Nov 26, 2026
Comment thread pkg/kvcache/lmcache.go Resolved

#### LMCache ProviderManaged Pool

The example overrides the cache server image and resource requests.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit: oeps/0010-kv-cache-server-component/oep.yaml still says status: provisional, but this PR merges the implementation of the LMCache ProviderManaged profile (new KVCachePool API, controller, webhook validation, Helm packaging). Per the OEP process, the design should be marked implementable (with reviewer/approver sign-off recorded) before the implementation lands — or this PR should note why it is intentionally landing against a provisional design. Updating the status in oep.yaml alongside this change would keep the process record consistent.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the full diff: new KVCachePool API and controller, LMCache provider reconciliation, engine binding/rendering, admission validation, RBAC, and Helm packaging. The reconciliation is careful about ownership (pool-UID labels, owner-UID checks on the connection ConfigMap, delete preconditions), the finalizer correctly waits out draining Deployments/ReplicaSets/Pods, and the int/float normalization through k8s JSON avoids a patch loop with the provider CRD. Test coverage is strong (CRD/CEL validation, fake + optional envtest lifecycle, full isvc reconcile round-trip, Helm render and live lifecycle scripts). Two 🟡 nits posted inline: the hardcoded cluster.local domain in the connection endpoint check, and OEP-0010 still being marked provisional.

Add the pool, runtime connector and service reference types, generated
clients and schemas, doctor discovery, and a pool manifest.

Signed-off-by: Yue Sun <25257139+fredericsun@users.noreply.github.com>
Create one DaemonSet per pool and publish its local Service endpoint.
Keep the server while any service or draining workload uses the pool.

Signed-off-by: Yue Sun <25257139+fredericsun@users.noreply.github.com>
Configure the merged vLLM engine template and report binding status.
Include a runnable example and cache recovery guidance.

Signed-off-by: Yue Sun <25257139+fredericsun@users.noreply.github.com>
@fredericsun
fredericsun force-pushed the kvcachepool-lmcache-mvp branch from 2078b68 to f9f48d6 Compare November 27, 2026 03:27
@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

👋 The PR description doesn't fully follow
PULL_REQUEST_TEMPLATE.md:

  • Missing header: ## Why we need it
  • Missing header: ## How to test
  • Missing header: ## Checklist

Please update the PR description so reviewers have the context they need.

Apply the desired manifest with the existing field owner, forcing the
same fields and retaining the resource-version precondition. Read the
server response back into the child for DaemonSet readiness checks.
Exercise ConfigMap drift repair alongside an independently owned key.

Signed-off-by: Yue Sun <25257139+fredericsun@users.noreply.github.com>
Set privileged to false so reconciliation also updates existing
DaemonSets. Preserve host IPC and the configured NVIDIA RuntimeClass.
Cover fresh templates and upgrades from the prior privileged template.

Signed-off-by: Yue Sun <25257139+fredericsun@users.noreply.github.com>
Use the Kubernetes default for new NodeLocal servers. Cover the
rendered template and the newly reconciled DaemonSet. Drop the
upgrade fixture for experimental pools.

Signed-off-by: Yue Sun <25257139+fredericsun@users.noreply.github.com>
Signed-off-by: Yue Sun <25257139+fredericsun@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api API/Types changes in pkg/apis config Configuration changes controller Controller changes crd CRD definition changes dependencies Dependency updates documentation Documentation changes helm Helm chart changes inferenceservice InferenceService controller changes oep OME Enhancement Proposal rbac RBAC configuration changes tests Test changes webhook Webhook changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant